package com.project.restaurant.mapper;

import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.project.restaurant.pojo.OrderDetailItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2022-10-11
 */
@Mapper
public interface OrderDetailItemMapper extends BaseMapper<OrderDetailItem> {


    @Insert("<script>" +
            "insert into r_order_detail_item(item_id,order_id,meal_id,purchasing_meal_price,purchase_num) values" +
            "<foreach collection='list' item='item' separator=','>" +
                "(#{item.itemId},#{item.orderId},${item.mealId},${item.purchasingMealPrice},${item.purchaseNum})" +
            "</foreach>" +
            "</script>")
    int insertList(@Param(Constants.LIST) List<OrderDetailItem> items);
}
